import  React from "react";
import { useRoutes,Navigate} from "react-router-dom";
import Login from '../views/Login/Login' 
import Home from '../views/Home/Home' 
import Layout from '../components/layout/layout/index'
import Room  from   '../views/Room/Room'
import Build  from   '../views/Build/Build'
import RoomList from "../views/RoomList/RoomList";
//独立页面
const frameOut =[
  {path:'/login',element:<Login/>}
]
//功能页面
const frameIn =[
          { path:'index',element:<Home/>},
          { path:'setroom',element:<Room />},
          { path:'setbuild',element:<Build/>},
          { path:'roomlist',element: <RoomList /> },  
          { path:'*',element:<Navigate to='/index'/>},

]


const Router=()=>{
    let element = useRoutes([
      ...frameOut,
      {path:'/',element:<Navigate  to='/index'/>},
      {path:'/*',element:<Layout/>,children:frameIn}
        
        
    
     ]);
      return element
}

export default Router 




 